home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / etc / X11 / Sessions / Xsession
Text File  |  2006-04-12  |  2KB  |  108 lines

  1. #!/bin/sh
  2. # $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $
  3.  
  4. case $# in
  5. 1)
  6.     case $1 in
  7.     failsafe)
  8.         exec xterm -geometry 80x24-0-0
  9.         ;;
  10.     esac
  11. esac
  12.  
  13. # redirect errors to a file in user's home directory if we can
  14. for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER"
  15. do
  16.     if ( cp /dev/null "$errfile" 2> /dev/null )
  17.     then
  18.         chmod 600 "$errfile"
  19.         exec > "$errfile" 2>&1
  20.         break
  21.     fi
  22. done
  23.  
  24. # clean up after xbanner
  25. if which freetemp 2> /dev/null ; then
  26.     freetemp
  27. fi
  28.  
  29. startup=$HOME/.xsession
  30.  
  31. userresources=$HOME/.Xresources 
  32. usermodmap=$HOME/.Xmodmap 
  33. userxkbmap=$HOME/.Xkbmap
  34.  
  35. sysresources=/etc/X11/Xresources 
  36. sysmodmap=/etc/X11/Xmodmap 
  37. sysxkbmap=/etc/X11/Xkbmap
  38.  
  39. rh6sysresources=/etc/X11/xinit/Xresources 
  40. rh6sysmodmap=/etc/X11/xinit/Xmodmap 
  41.  
  42.  
  43. # merge in defaults
  44. if [ -f "$rh6sysresources" ]; then
  45.     xrdb -merge "$rh6sysresources"
  46. fi
  47.  
  48. if [ -f "$sysresources" ]; then
  49.     xrdb -merge "$sysresources"
  50. fi
  51.  
  52. if [ -f "$userresources" ]; then
  53.     xrdb -merge "$userresources"
  54. fi
  55.  
  56. # merge in keymaps
  57. if [ -f "$sysxkbmap" ]; then
  58.     setxkbmap `cat "$sysxkbmap"`
  59.     XKB_IN_USE=yes
  60. fi
  61.  
  62. if [ -f "$userxkbmap" ]; then
  63.     setxkbmap `cat "$userxkbmap"`
  64.     XKB_IN_USE=yes
  65. fi
  66.  
  67. #
  68. # Eeek, this seems like too much magic here
  69. #
  70. if [ -z "$XKB_IN_USE" -a ! -L /etc/X11/X ]; then
  71.     if grep '^exec.*/Xsun' /etc/X11/X > /dev/null 2>&1 && [ -f /etc/X11/XF86Config ]; then
  72.        xkbsymbols=`sed -n -e 's/^[     ]*XkbSymbols[   ]*"\(.*\)".*$/\1/p' /etc/X11/XF86Config`
  73.        if [ -n "$xkbsymbols" ]; then
  74.            setxkbmap -symbols "$xkbsymbols"
  75.            XKB_IN_USE=yes
  76.        fi
  77.     fi
  78. fi
  79.  
  80. # xkb and xmodmap don't play nice together
  81. if [ -z "$XKB_IN_USE" ]; then
  82.     if [ -f "$rh6sysmodmap" ]; then
  83.        xmodmap "$rh6sysmodmap"
  84.     fi
  85.  
  86.     if [ -f "$sysmodmap" ]; then
  87.        xmodmap "$sysmodmap"
  88.     fi
  89.  
  90.     if [ -f "$usermodmap" ]; then
  91.        xmodmap "$usermodmap"
  92.     fi
  93. fi
  94.  
  95. unset XKB_IN_USE
  96.  
  97. if [ -x "$startup" ]; then
  98.     exec "$startup"
  99. elif [ -x "$HOME/.Xclients" ]; then
  100.     exec "$HOME/.Xclients"
  101. elif [ -x /etc/X11/xinit/Xclients ]; then
  102.     exec /etc/X11/xinit/Xclients
  103. elif [ -x /etc/X11/Xclients ]; then
  104.     exec /etc/X11/Xclients
  105. else
  106.     exec xsm
  107. fi
  108.